#!/bin/bash

#备份
cp /etc/yum.repos.d/* /bak/
#挂载光盘
mkdir /opt/cd
mount /dev/sr0 /opt/cd

#配yum源
cat << eof  > /etc/yum.repos.d/local.repo
[localhost]
name=localhost
baseurl=file:///opt/cd
enabled=1
gpgcheck=0
eof

yum clean all &> /dev/null
yum repolist
